/*
 * This next statement is going to use code to
 * change the "current" database to AdventureWorks.
 * This makes certain, right in the code, that you are going
 * to the corrent database
 * */

 USE AdventureWorks2012;

 /*
  * This next statement declares your working table
  * This parricular table is actually a variable your are declaring
  * on the fly.
  * */

DECLARE @MyTable TABLE
(
	SalesOrderID	int,
	CustomerID		char(5)
);

/*
 * Now that you have your table variable, your're ready
 * to populate it with data from your SELCET statement.
 * Note that you could just as easily insert the
 * data into a ermanent table (instead of a table variable).
 * */

 INSERT INTO @MyTable
	SELECT SalesOrderID, CustomerID
	FROM AdventureWorks2012.Sales.SalesOrderHeader
	WHERE SalesOrderID  BETWEEN 44000 AND 44010;

-- Finally, make sure that the data was inserted like you think
SELECT *
FROM @MyTable;